package com.xwzn.resident.fragment;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.xwzn.resident.LoginActivity;
import com.xwzn.resident.PersonalInformationActivity;
import com.xwzn.resident.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @Description:个人中心
 * @Author: XuQiHao
 * @CreateDate: 2019/12/23 11:28
 * @Version: 1.0
 */
public class FourFragment extends Fragment {
    private View view;
    @BindView(R.id.ll_title)
    LinearLayout ll_title;
    @BindView(R.id.ll_police)
    LinearLayout ll_police;
    @BindView(R.id.ll_Collection)
    LinearLayout ll_Collection;
    @BindView(R.id.ll_House)
    LinearLayout ll_House;
    @BindView(R.id.ll_identity)
    LinearLayout ll_identity;
    @BindView(R.id.ll_key)
    LinearLayout ll_key;
    @BindView(R.id.ll_integral)
    LinearLayout ll_integral;
    @BindView(R.id.ll_Repair)
    LinearLayout ll_Repair;
    @BindView(R.id.ll_Visitor)
    LinearLayout ll_Visitor;
    @BindView(R.id.ll_Goods)
    LinearLayout ll_Goods;
    @BindView(R.id.ll_car)
    LinearLayout ll_car;
    @BindView(R.id.ll_Record)
    LinearLayout ll_Record;
    @BindView(R.id.ll_mailbox)
    LinearLayout ll_mailbox;
    @BindView(R.id.ll_Furnishing)
    LinearLayout ll_Furnishing;
    @BindView(R.id.ll_Telephone)
    LinearLayout ll_Telephone;
    @BindView(R.id.ll_manual)
    LinearLayout ll_manual;
    Intent intent;
    Intent intent2;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //填充布局
        view = inflater.inflate(R.layout.fragment_my, container, false);
        //绑定ButterKnife
        ButterKnife.bind(this, view);
        return view;
    }

    @OnClick({R.id.ll_title, R.id.ll_police, R.id.ll_Collection,
            R.id.ll_House, R.id.ll_identity, R.id.ll_key, R.id.ll_integral,
            R.id.ll_Repair, R.id.ll_Visitor, R.id.ll_Goods, R.id.ll_car, R.id.ll_Record,
            R.id.ll_mailbox, R.id.ll_Furnishing, R.id.ll_Telephone, R.id.ll_manual})
    void abc(View v) {
        switch (v.getId()) {
            //欢迎使用
            case R.id.ll_title:
                //如果未登录跳转登录界面,如果登录跳转个人信息
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {
                    intent2 = new Intent(getActivity(), PersonalInformationActivity.class);
                    startActivity(intent2);
                }
                break;
            //报警信息
            case R.id.ll_police:
                //如果未登录跳转登录界面,登录后未登记，提示登记
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {
                    if (false) {
                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //我的收藏
            case R.id.ll_Collection:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //我的房屋
            case R.id.ll_House:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //身份管理
            case R.id.ll_identity:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //开门钥匙
            case R.id.ll_key:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //积分
            case R.id.ll_integral:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //物业保障
            case R.id.ll_Repair:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //访客记录
            case R.id.ll_Visitor:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                //大件物品
                break;
            case R.id.ll_Goods:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //我的车辆
            case R.id.ll_car:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //申请记录
            case R.id.ll_Record:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //意见邮箱
            case R.id.ll_mailbox:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //智能家居
            case R.id.ll_Furnishing:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //便捷电话
            case R.id.ll_Telephone:
                if (false) {
                    intent = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent);
                } else {

                    if (false) {

                    } else {
                        final AlertDialog.Builder a = new AlertDialog.Builder(getActivity());
                        a.setTitle("提示");
                        a.setMessage("请使用本人信息到【首页->入住登记】进行第一次登记授权!");
                        a.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                        a.show();
                    }
                }
                break;
            //操作手册
            case R.id.ll_manual:
                Toast.makeText(getActivity(), "aaa", Toast.LENGTH_LONG).show();
                break;
        }
    }

}


